class Datasheet < ActiveRecord::Base
  has_and_belongs_to_many	:pages

  has_attachment  :storage      => :file_system, 
                  :max_size     => 10000.kilobytes,
                  :processor    => :Rmagick
                  
  validates_as_attachment
  validates_presence_of   :name
  validates_uniqueness_of :name

	def to_param
    "#{id}-#{name.downcase.gsub(/[^[:alnum:]]/,'-')}".gsub(/-{2,}/,'-')   
  end
end
